dates

There are several parties working on my database, and half of them define dates as strings. Is there a way to convert a string to a date variable for easy comparison?
SystemAdmin - Mon Jun 15 17:29:12 EDT 2009

Re: dates
Tony_Goodman - Tue Jun 16 03:17:12 EDT 2009

If the string is correctly formed, i.e. DOORS can understand it, then you can assign a string value to a date variable directly.

Date d = "26 June 1966"
or
d = "6/2/66"


Be careful of day/month being mis-interpreted if you use the second form. By default DOORS assumes mm/dd/yyyy, not dd/mm/yyyy, even if your locale is set to UK.

Re: dates
llandale - Tue Jun 16 09:44:37 EDT 2009

Tony_Goodman - Tue Jun 16 03:17:12 EDT 2009

If the string is correctly formed, i.e. DOORS can understand it, then you can assign a string value to a date variable directly.

Date d = "26 June 1966"
or
d = "6/2/66"


Be careful of day/month being mis-interpreted if you use the second form. By default DOORS assumes mm/dd/yyyy, not dd/mm/yyyy, even if your locale is set to UK.

Yup, that makes "6/2/66" a lousy format for DOORS; that's "1966 June 2" whereas "13/2/66" is "1966 Feb 13".

My standard format for reports (including the name of the report) is "1966-Jun-02"; a nice combination of easy-to-understand and sorts-reasonably-well. Have been thinking about changing to "1966-06-02" which sorts perfectly, but isn't quite as easy to understand.

  • Louie

Re: dates
kbmurphy - Tue Jun 16 18:27:55 EDT 2009

llandale - Tue Jun 16 09:44:37 EDT 2009
Yup, that makes "6/2/66" a lousy format for DOORS; that's "1966 June 2" whereas "13/2/66" is "1966 Feb 13".

My standard format for reports (including the name of the report) is "1966-Jun-02"; a nice combination of easy-to-understand and sorts-reasonably-well. Have been thinking about changing to "1966-06-02" which sorts perfectly, but isn't quite as easy to understand.

  • Louie

"1966-06-02" is the ISO standard for writing a date.

http://en.wikipedia.org/wiki/ISO_8601

Re: dates
llandale - Wed Jun 17 17:52:12 EDT 2009

kbmurphy - Tue Jun 16 18:27:55 EDT 2009
"1966-06-02" is the ISO standard for writing a date.

http://en.wikipedia.org/wiki/ISO_8601

Well, I already had defined format "2009-06-17" (in my Date-to-string function) but wasn't using it. So I changed my default to that and then my DXL started blowing up. Turns out, SURPRISE!!, that DOORS does not recognize that format.

Date d = "2009-06-17" // produces run time errors.

I already had a string-to-date function which I then had to update, and also recognize "2009-6-17". I then had to find in all my scripts places that do this: Date d = <some format generated by me>, and change them all to Date d = fDateOf(<some format generated by me>).

None of my Dates are easy; not sure why I would expect my DOORS Dates to be any different.

  • Louie